package net.homelinux.ajay.net.ondisk.model.client;


import net.homelinux.ajay.net.ondisk.view.client.CollectionTreeItem;

import com.google.gwt.http.client.Response;

public class Link extends AppObject{

  public static final int INITIALIZED = 0;
  public static final int LOADED = 5;
  public static final int DEQUEUED = 3;
  public static final int ERROR = 4;
  private int httpLoadStatus = INITIALIZED;
  private String url;
  private int size;

  public void setUrl(String url) {
    this.url = url;
  }

  public int getHttpLoadStatus() {
    return httpLoadStatus;
  }

  public void setHttpLoadStatus(int status) {
    httpLoadStatus = status;
  }

  public String getUrl() {
    return url;
  }

  public String toString() {
    String string = url+":";
    if(httpLoadStatus<LOADED){
      string = string + getStatusString(httpLoadStatus);
    }
    else{
      string = string + "{ size="+getSize()+"}";
    }
    
    return string;
    
  }

  public int getSize() {
    return size;
  }

  public static String getStatusString(int httpLoadStatus) {
    switch(httpLoadStatus){
      case INITIALIZED: return "INITIALIZED";
      case DEQUEUED: return "DEQUEUED";
      case ERROR: return "ERROR";
      case LOADED: return "LOADED";
      default: return "UNKNOWN STATUS";
    }
  }

  public void setSize(int i) {
    size = i;
  }


}
